
package com.nx.vip.javacore.generic.effect;

import java.util.ArrayList;
import java.util.List;

/**
 * 1、保证类型安全，编译阶段类型检查
 * 2、避免类型转换硬编码
 * 3、调用代码重用性
 */
public class ArryListDemo {

    public void hasGen(){
        List<Integer> list = new ArrayList<>(); //1.7
        list.add(123);
        list.add(124);
        System.out.println("---------------");
        System.out.println(list.get(0).compareTo(list.get(1)));


    }

    public void noGen(){
        List list = new ArrayList();
        list.add(123);
        list.add(124);
        System.out.println("---------------");
        System.out.println(((Integer) list.get(0)).compareTo((Integer)list.get(1)));

    }
}
